package algorithm.poj.p1000;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLDecoder;
import java.util.StringTokenizer;

/**
 * 
 * @author wong.tong@gmail.com
 *
 */
public class P1658 {

	public static void main(String[] args) throws Exception {

		InputStream input = null;
		if (false) {
			input = System.in;
		} else {
			URL url = P1658.class.getResource("P1658.txt");
			File file = new File(URLDecoder.decode(url.getPath(), "UTF-8"));
			input = new FileInputStream(file);
		}
		
		BufferedReader stdin = new BufferedReader(new InputStreamReader(input));

		int t = Integer.valueOf(stdin.readLine().trim());
		for (int i = 0; i < t; i ++) {
			StringTokenizer st = new StringTokenizer(stdin.readLine());
			int a = Integer.valueOf(st.nextToken());
			int b = Integer.valueOf(st.nextToken());
			int c = Integer.valueOf(st.nextToken());
			int d = Integer.valueOf(st.nextToken());
			int e = -1;
			if (b-a == c-b && c-b == d-c) {
				e = 2*d-c;
			} else {
				e = d/c*d;
			}
			System.out.println(a+ " " + b + " " + c + " " + d + " " + e);
		}
	}
}